@font-face {
  font-family: "Optimistic Display";
  src: url("/fonts/Optimistic-Display-Light.woff2")
  format("woff2");
  font-weight: 300;
  font-style: normal;
}

@font-face {
  font-family: "Optimistic Display";
  src: url("/fonts/Optimistic-Display-Regular.woff2")
  format("woff2");
  font-weight: 500;
  font-style: normal;
}

@font-face {
  font-family: "Optimistic Display";
  src: url("/fonts/Optimistic-Display-Bold.woff2")
  format("woff2");
  font-weight: 700;
  font-style: normal;
}

*:focus-visible {
  outline-style: solid;
  outline-width: 2px;
  outline-color: var(--outline);
  border-radius: 3px;
}

html, body {
  background: var(--overscroll-background);
  min-height: 100%;
  font-family: "Optimistic Display", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

input:focus-visible  {
  border-radius: 6px;
}

#__next, #__next > div {
  min-height: 100vh;
}

/* SELECT */

select {
  display: flex;
  min-width: 156px;
  height: 24px;
  align-items: center;
  cursor: pointer;

  @supports (font: -apple-system-body) {
    appearance: none;
    min-width: 136px;
    padding-left: 4px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='%23fff'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m19.5 8.25-7.5 7.5-7.5-7.5' /%3E%3C/svg%3E%0A");
    background-repeat: no-repeat;
    background-size: 16px 16px;
    background-position: 95% 4px;
  }

  @supports (appearance: base-select) {
    appearance: base-select;
    padding-inline: 4px;
    background-image: none;
    color: #fff;

    &::picker-icon {
      content: "";
      width: 16px;
      height: 16px;
      margin-right: 2px;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='%23fff'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m19.5 8.25-7.5 7.5-7.5-7.5' /%3E%3C/svg%3E%0A");
      transition: rotate 0.2s ease-out;
    }

    &:open::picker-icon {
      rotate: 180deg;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='%2361DAFB'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m19.5 8.25-7.5 7.5-7.5-7.5' /%3E%3C/svg%3E%0A");
    }

    &::picker(select) {
      appearance: base-select;
      padding: 2px;
      margin-top: 6px;
      border: 2px solid var(--select-border);
      background: var(--select-background);
      border-radius: 6px;
      font-weight: 400;
      opacity: 0;
      overflow: clip;
      transition: opacity 0.5s ease-out;
      box-shadow: hsl(206 22% 7% / 60%) 0 10px 32px -8px, hsl(206 22% 7% / 40%) 0 10px 18px -12px;
    }

    &:open::picker(select) {
      opacity: 1;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      gap: 2px;

      @starting-style {
        opacity: 0;
      }
    }

    option {
      display: flex;
      align-items: center;
      padding: 2px 8px;
      cursor: pointer;
      border-radius: 3px;
      transition: background 0.2s ease-out;
      color: #fff !important;

      &:where(:hover, :focus, :active) {
        background: color-mix(in srgb, var(--select-border) 60%, transparent);
      }

      &:checked {
        background: var(--active);
      }

      &:checked:hover {
        background: color-mix(in srgb, var(--active) 60%, transparent);
      }

      &::checkmark {
        display: none;
      }
    }
  }
}

/* TOOLTIP */

.TooltipContent {
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 300;
  line-height: 1.5;
  color: #fff;
  background: #000;
  border: 1px solid var(--tooltip-border);
  box-shadow: hsl(206 22% 7% / 40%) 0 10px 32px -8px, hsl(206 22% 7% / 25%) 0 10px 18px -12px;
  user-select: none;
  animation-duration: 400ms;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
  max-width: 220px;

  svg {
    position: relative;
    top: -0.25px;

    path {
      stroke: var(--tooltip-border);
      stroke-width: 1.5px;
    }
  }
}

.TooltipContent[data-state='delayed-open'][data-side='top'] {
  animation-name: slideDownAndFade;
}

.TooltipContent[data-state='delayed-open'][data-side='right'] {
  animation-name: slideLeftAndFade;
}

.TooltipContent[data-state='delayed-open'][data-side='bottom'] {
  animation-name: slideUpAndFade;
}

.TooltipContent[data-state='delayed-open'][data-side='left'] {
  animation-name: slideRightAndFade;
}

@keyframes slideUpAndFade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideRightAndFade {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideDownAndFade {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideLeftAndFade {
  from {
    opacity: 0;
    transform: translateX(6px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* THREE DOTS LOADER */

#dots-loader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: row;
  gap: 6px;

  .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    animation: dots-bounce 1.2s infinite ease-in-out both;
    opacity: 0.9;

    &:nth-child(1) {
      animation-delay: 0s;
    }

    &:nth-child(2) {
      animation-delay: calc(1.2s / 6);
    }

    &:nth-child(3) {
      animation-delay: calc(1.2s * 2 / 6);
    }
  }
}

@keyframes dots-bounce {
  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* PACKAGE STICKY CONTAINER */

#metadataContainer {
  top: 26px;
  height: fit-content;
  position: sticky;
}

/* README WRAPPER */

#readmeMarkdownContainer {
  font-size: 90%;
  line-height: 1.4;

  *:first-child {
    margin-top: 0;
  }

  *:last-child {
    margin-bottom: 0;
  }

  section {
    margin-top: 18px;
  }

  img {
    margin-top: 12px;
  }

  img + img {
    margin-top: 8px;
  }

  h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0;

    & a {
      font-size: inherit;
    }

    & img {
      display: block;
    }

    &[align="center"] img {
      margin: 0 auto;
    }

    + div {
      margin-top: 12px;
    }
  }

  p {
    margin-bottom: 0;

    & a {
      font-size: inherit;
    }
  }

  a:has(img) {
    display: inline-flex;
    text-decoration: none !important;
  }

  a:has(code) {
    font-size: 100%;
  }

  code, pre, a  {
    white-space: pre-wrap;
    word-break: auto-phrase;
  }

  code {
    font-size: 110%;
    background-color: var(--inline-code-background);
    border-radius: 4px;
    padding: 1px 4px;
  }

  pre {
    margin-bottom: 0;

    code {
      background-color: unset;
      border-radius: unset;
      padding: unset;
    }

    &.shiki {
      border-radius: 6px;
      padding: 12px 32px 12px 16px;
      background-color: var(--code-block-background) !important;
    }
  }

  picture {
    display: block;
  }

  img {
    max-width: 100%;

    &:not([width]) {
      width: min-content;
    }
  }

  blockquote {
    margin-block-start: 8px;
    margin-block-end: 0;
    margin-inline-start: 0;
    padding-inline-start: 1rem;
    padding-block-start: 0.25rem;
    padding-block-end: 0.25rem;
    border-left-width: 3px;
    border-left-style: solid;

    .blockquote-title {
      font-weight: 600;
      margin-bottom: -4px;
      display: block;
    }

    &.note {
      border-left-color: #4493f8;

      .blockquote-title {
        color: #4493f8;
      }
    }

    &.tip {
      border-left-color: #238636;

      .blockquote-title {
        color: #238636;
      }
    }

    &.important {
      border-left-color: #ab7df8;

      .blockquote-title {
        color: #ab7df8;
      }
    }

    &.warning {
      border-left-color: #9e6a03;

      .blockquote-title {
        color: #9e6a03;
      }
    }

    &.caution {
      border-left-color: #da3633;

      .blockquote-title {
        color: #da3633;
      }
    }
  }

  ul, ol {
    margin-inline-start: 0.75rem;
    padding-inline-start: 1rem;
    margin-bottom: 0;

    ul, ol {
      padding-top: 8px;
      margin-inline-start: 0;
    }
  }

  li {
    &:last-child {
      margin-bottom: 12px;
    }

    pre {
      margin-top: 8px !important;
    }
  }

  details {
    padding-inline-start: 1rem;

    summary {
      margin-top: 8px !important;
      cursor: pointer;
    }
  }

  div[data-table-wrapper] {
    max-width: 100%;
    width: fit-content;
    overflow-x: auto;
    border-radius: 9px;
    border: 1px solid var(--table-border);
  }

  table {
    margin-top: 8px;
    border-collapse: collapse;
    width: fit-content;

    a:has(img) {
      display: inline-block;
      text-align: inherit;
    }

    sub, sup {
      text-align: inherit;
    }
  }

  tr {
    &:first-child {
      td, th {
        border-top: 0;
      }
    }

    &:last-child {
      td {
        border-bottom: 0;
      }
    }

    &:nth-child(2n) {
      background-color: var(--table-alt-row);
    }
  }

  td, th {
    border: 1px solid var(--table-border);
    padding: 5px 8px;

    &:first-child {
      border-left: 0;
    }

    &:last-child {
      border-right: 0;
    }
  }

  th {
    background-color: var(--table-header-background);
  }
}